#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2019 crane <crane@gosun>
#
# Distributed under terms of the MIT license.

"""

"""

import random


class Solution:
    def __init__(self):
        pass

    def find_idx(self, lst):
        lst = list(lst)
        A = lst[0:4]
        B = lst[4:8]
        C = lst[8:12]

        if sum(A) == sum(B):
            # 异常球在C
            sa3 = sum(A[:3])
            sc3 = sum(C[:3])
            if sa3 == sc3:
                return self.idx('C', 3)

            if sa3 > sc3:
                # 较轻
                if C[0] == C[1]:
                    return self.idx('C', 2)
                if C[0] > C[1]:
                    return self.idx('C', 1)
                else:
                    return self.idx('C', 0)
            if sa3 < sc3:
                # 重
                if C[0] == C[1]:
                    return self.idx('C', 2)
                if C[0] > C[1]:
                    return self.idx('C', 0)
                else:
                    return self.idx('C', 1)

        if sum(A) < sum(B):
            pass

    def idx(self, s, idx):
        d = {
            'A' : 0,
            'B' : 4,
            'C' : 8
        }

        return d[s] + idx

def test():
    s = Solution()
    base_lst1 = 11 * [3] + [2]
    base_lst2 = 11 * [3] + [4]

    lst1 = random.shuffle(base_lst1)

    s.find_idx(lst1)


def main():
    print("start main")
    test()

if __name__ == "__main__":
    main()
